import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttermodule/utils/screen.dart';

//分类的item
class AssortItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    setScreenSize(context);
    return Container(
      child: Row(
        mainAxisSize: MainAxisSize.min,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            margin: EdgeInsets.only(
                left: dpWidth(40),
                top: dpHeight(20),
                bottom: dpHeight(20),
                right: dpWidth(20)),
            child: Image.asset(
              'assets/university/images/home_img_zcbb@2x.png',
              height: dpHeight(80),
              width: dpWidth(80),
            ),
          ),
          Column(
            mainAxisSize: MainAxisSize.min,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: <Widget>[
              Container(
                margin: EdgeInsets.only(top: dpHeight(30)),
                child: Text(
                  '职场必备',
                  style: TextStyle(
                      color: Color.fromARGB(255, 51, 51, 51),
                      fontSize: spFont(28),
                      fontWeight: FontWeight.bold),
                ),
              ),
              Text(
                '管理团队大本领',
                style: TextStyle(
                  fontSize: spFont(20),
                  color: Color.fromARGB(255, 51, 51, 51),
                ),
              )
            ],
          )
        ],
      ),
    );
  }
}

//微视频的item
class MicroVideoItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      margin: EdgeInsets.only(
          top: dpHeight(20),
          bottom: dpHeight(10),
          left: dpWidth(10),
          right: dpWidth(10)),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          ClipRRect(
            borderRadius: BorderRadius.circular(dpHeight(5)),
            child:  Image.network(
              "http://fastdfs.dgg188.cn/group1/M00/09/DC/CgIBv138OTSAKpsyAADR28nkpgI935.jpg",
              height: dpHeight(180),
              fit: BoxFit.cover,
            ),
          ),
          Container(
            margin: EdgeInsets.only(top: dpHeight(20)),
            child: Text(
              '可复制领导力',
              style: TextStyle(
                  color: Color.fromARGB(255, 51, 51, 51),
                  fontWeight: FontWeight.bold,
                  fontSize: spFont(32)),
            ),
          ),
          Text.rich(TextSpan(children: [
            TextSpan(
                text: '黄建明',
                style: TextStyle(
                    color: Color.fromARGB(255, 51, 51, 51),
                    fontSize: spFont(26))),
            TextSpan(
                text: '  集团董事长',
                style: TextStyle(
                    color: Color.fromARGB(255, 51, 51, 51),
                    fontSize: spFont(26)))
          ]))
        ],
      ),
    );
  }
}

//最新课程的item
class NewCourseItem extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: Column(
        children: <Widget>[
          Flex(
            crossAxisAlignment: CrossAxisAlignment.start,
            direction: Axis.horizontal,
            children: <Widget>[
              Container(
                margin: EdgeInsets.only(
                    top: dpHeight(32), bottom: dpHeight(32), left: dpWidth(28)),
                height: dpHeight(190),
                width: dpWidth(144),
                child: Stack(
                  children: <Widget>[
                   ClipRRect(
                     borderRadius: BorderRadius.circular(dpHeight(5)),
                     child:  Image.network(
                       'http://fastdfs.dggvip.net:8080/group1/M00/0E/23/CgAAB17nMvmEN-E5AAAAAP81hxw845.png',
                       height: dpHeight(190),
                       width: dpWidth(144),
                       fit: BoxFit.cover,
                     ),
                   ),
                    Align(
                      alignment: Alignment.topRight,
                      child: Container(
                        margin: EdgeInsets.all(dpWidth(8)),
                        padding: EdgeInsets.all(dpWidth(7)),
                        child: Image.asset(
                          'assets/university/images/img_yinpinicon@2x.png',
                          height: dpHeight(16),
                          width: dpWidth(16),
                        ),
                        decoration: BoxDecoration(
                            color: Color.fromARGB(51, 0, 0, 0),
                            borderRadius:
                            BorderRadius.all(Radius.circular(dpWidth(20)))),
                      ),
                    ),
                    Align(
                      alignment: Alignment.bottomLeft,
                      child: Container(
                        alignment: Alignment.centerLeft,
                        margin: EdgeInsets.only(right: dpWidth(27)),
                        padding:
                        EdgeInsets.only(bottom: dpHeight(2), left: dpWidth(11)),
                        height: dpHeight(40),
                        child: Text(
                          "405人看过",
                          style:
                          TextStyle(color: Colors.white, fontSize: spFont(20)),
                        ),
                        decoration: BoxDecoration(
                            color: Color.fromARGB(51, 0, 0, 0),
                            borderRadius: BorderRadius.only(
                                topRight: Radius.circular(dpHeight(20)),
                                bottomLeft: Radius.circular(dpHeight(5)),
                                bottomRight: Radius.circular(dpHeight(20)))),
                      ),
                    )
                  ],
                ),
              ),
              Container(
                height: dpHeight(190),
                margin: EdgeInsets.only(
                    top: dpHeight(32),
                    bottom: dpHeight(32),
                    left: dpWidth(27),
                    right: dpWidth(47)),
                child: Column(
                  mainAxisSize: MainAxisSize.max,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: <Widget>[
                    Text(
                      "创造力自信：打造设计思维的训练",
                      style: TextStyle(
                          fontWeight: FontWeight.bold,
                          fontSize: spFont(32),
                          color: Color.fromARGB(255, 51, 51, 51)),
                    ),
                    Text.rich(TextSpan(children: [
                      TextSpan(
                          text: "黄建明  ",
                          style: TextStyle(
                              color: Color.fromARGB(255, 51, 51, 51),
                              fontSize: spFont(26))),
                      TextSpan(
                          text: "顶呱呱集团董事长、五星讲师",
                          style: TextStyle(
                              color: Color.fromARGB(255, 102, 102, 102),
                              fontSize: spFont(26)))
                    ])),
                    Expanded(child:  Row(
                      children: <Widget>[
                        Container(
                          child: Image.asset(
                            "assets/university/images/home_img_zongguangkan@2x.png",
                            width: dpWidth(26),
                            height: dpHeight(26),
                          ),
                          margin: EdgeInsets.only(right: dpWidth(7)),
                          padding: EdgeInsets.only(top: dpHeight(2)),
                        ),
                        Text.rich(TextSpan(children: [
                          TextSpan(
                              text: "总观看 ",
                              style: TextStyle(
                                  color: Color.fromARGB(255, 102, 102, 102),
                                  fontSize: spFont(24))),
                          TextSpan(
                              text: '41小时20分钟',
                              style: TextStyle(
                                  color: Color.fromARGB(255, 205, 110, 107),
                                  fontSize: spFont(24)))
                        ]))
                      ],
                    )),
                    Row(
                      children: <Widget>[
                        Container(
                          margin: EdgeInsets.only(right: dpWidth(20)),
                          padding: EdgeInsets.only(top: dpHeight(7),bottom: dpHeight(11),left: dpWidth(11),right: dpWidth(11)),
                          child: Text(
                            '新人必看',
                            style: TextStyle(
                                color: Color.fromARGB(255, 153, 153, 153),
                                fontSize: spFont(26)),
                          ),
                          decoration: BoxDecoration(
                              color: Color.fromARGB(255,247,242,234),
                              borderRadius: BorderRadius.all(Radius.circular(dpHeight(4)))
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(right: dpWidth(20)),
                          padding: EdgeInsets.only(top: dpHeight(7),bottom: dpHeight(11),left: dpWidth(11),right: dpWidth(11)),
                          child: Text(
                            '最优商务分享',
                            style: TextStyle(
                                color: Color.fromARGB(255, 153, 153, 153),
                                fontSize: spFont(26)),
                          ),
                          decoration: BoxDecoration(
                              color: Color.fromARGB(255,247,242,234),
                              borderRadius: BorderRadius.all(Radius.circular(dpHeight(4)))
                          ),
                        )
                      ],
                    )
                  ],
                ),
              )
            ],
          ),
          Container(color: Color.fromARGB(255,238,238,238),height: dpHeight(1),margin: EdgeInsets.only(
            left: dpWidth(28)
          ),)
        ],
      ),
    );
  }
}
